import urllib.request
import urllib.parse
import urllib.error
#url报错  url错误
# HTTP异常属于url异常
url="https://blog.csdn.net/u011307484/article/details/126086382"
# urllib.error.URLError     url异常
# url="http://www.goudan111.com"
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0'
}
try:
    request = urllib.request.Request(url=url, headers=headers)
    response = urllib.request.urlopen(request)
    content = response.read().decode('utf-8')
except urllib.error.HTTPError as e:
    print("系统正在升级.....")
except urllib.error.URLError as e:
    print("我都说了系统在升级.....")